
<template>
  <div class="leftTree">
    <addHeader :title="'栏目'"
               :hasBtn="hasBtn"
               :btnName="'新增'"
               @click="goAdd"></addHeader>
    <div class="treeBody">
      <commonleftTree ref="commonleftTree"
                      @getSelectNode="getSelectNode" :show-out="showOut"></commonleftTree>
    </div>
  </div>
</template>

<script>
import addHeader from './addHeader'
import commonleftTree from './commonleftTree'
export default {
  name: 'leftTree',
  props: ['hasBtn','showOut'],
  components: {
    addHeader,
    commonleftTree,
  },
  methods: {

    goAdd() {
      let node = this.$refs.commonleftTree.selectNode
      if (node == null) {
        this.$message.warning('请选择父级节点')
        return
      } else if (node.colName == '模块架构') {
        this.$emit('goAdd', { colName: '模块架构', id: '0' })
        return
      } else if (node.isAddable == '1') {
        this.$emit('goAdd', node)
        return
      }
      this.$message.warning('该栏目不可新增子栏目')
    },
    getSelectNode(node) {
      this.$emit('getSelectNode', node)
    },
    addleft() {},
  },
  data() {
    return {
      dialogVisible: false,
    }
  },
}
</script>

<style scoped lang="less">
.el-tree {
  background-color: transparent;
}
.leftTree {
  width: 220px;
  height: 100%;
  //border:1px solid black;
  .treeBody {
    width: 100%;
    height: calc(100% - 48px);
    background: #fafafa;
    border: 1px solid #eeeeee;
    border-top: none;
    border-right: none;
    //border-radius: 8px 0px 0px 8px;
    overflow-y: auto;
  }
}
/deep/.el-tree-node{
  margin-bottom: 5px;
}

</style>
